
#ifndef _WIN32
#include <unistd.h> // for vfork, execl, _exit
#endif

#include <sys/types.h> // for pid_t
#include <stdio.h> // for printf
namespace unix_Vfork {
    void foo() {
        printf("Function foo called\n");
    }

int test(int x) {

#ifndef _WIN32
    pid_t pid = vfork(); // warn
    if (pid != 0)
        return 0;

    switch (x) {
    case 0:
        pid = 1;
        execl("", "", 0);
        _exit(1);
        break;
    case 1:
        x = 0; // warn: this assignment is prohibited
        break;
    case 2:
        foo(); // warn: this function call is prohibited
        break;
    default:
        return 0; // warn: return is prohibited
    }
#endif
    while (1);
}
}